package chapter2.No2_2_synchronized同步语句块.p锁对象的改变.demo2;

/**
 * Created by Administrator on 2016/11/15.
 */
public class ServiceClass {

    public void methodA(UserBean bean) {
        synchronized (bean) {
            try {
                System.out.println(Thread.currentThread().getName() + " 线程进入：值为+" + bean.toString());
                Thread.sleep(1000);
                System.out.println(Thread.currentThread().getName() + " 线程退出：值为+" + bean.toString());
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

}
